import request from '@/utils/request'

// 媒体目录列表
export function fetchCatalogList(params) {
  return request({
    url: '/operation/opMediaDirectory/queryList',
    method: 'get',
    params: {
      'name': params.name,
      'orgId': params.orgId,
      'parentId': params.parentId,
      'type': params.type, // 1：素材；2：广告；3：计划；4：广告屏
      'pageIndex': params.pageIndex,
      'pageSize': params.pageSize
    },
    port: { ENV_PORT: 8004 },
    ajaxType2: 'reqGet'

  })
}

// 添加目录
export function catalogAdd(data) {
  return request({
    url: '/operation/opMediaDirectory/add',
    method: 'post',
    data,
    port: { ENV_PORT: 8004 },
    ajaxType2: 'reqPost'

  })
}

// 修改目录
export function catalogUpdate(data) {
  return request({
    url: '/operation/opMediaDirectory/update',
    method: 'put',
    data,
    port: { ENV_PORT: 8004 },
    ajaxType2: 'reqPut'

  })
}

// 删除目录
export function catalogDelete(id) {
  return request({
    url: '/operation/opMediaDirectory/delete',
    method: 'delete',
    params: { id },
    port: { ENV_PORT: 8004 },
    ajaxType2: 'reqDelete'

  })
}
